﻿Imports System.Data
Partial Class pu_jpg_1
    Inherits System.Web.UI.Page
    Private mp1 As String
    Private Property p1() As String
        Get
            Return Utility.ParsePartNo(mp1)
        End Get
        Set(ByVal value As String)
            mp1 = value
        End Set
    End Property
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        'Dim p1 As String
        p1 = Request.QueryString("p1")
        Dim dt As DataTable
        'dt = Utility.GetProdPict(p1)
        dt = Utility.GetProdPict1(p1)
        GV1.DataSource = dt
        GV1.DataBind()
    End Sub

    Protected Sub GV1_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GV1.RowDataBound
        If (e.Row.RowType = DataControlRowType.DataRow) Then
            Dim urlStr As String
            Dim link As HyperLink
            Dim i As Integer
            'urlStr = Utility.ParsePartNo("GJ21E34098AA")
            urlStr = "pu_pop.aspx?p1={2}&rowIndex={0}&colIndex={1}"
            For i = 1 To e.Row.Cells.Count - 1
                If (e.Row.Cells(i).Text.Trim() <> String.Empty) Then
                    'If (e.Row.Cells(i).Text.Trim() <> "沒圖片") Then
                    link = New HyperLink()
                    link.Text = "看圖片" 'e.Row.Cells(i).Text
                    link.NavigateUrl = String.Format(urlStr _
                                         , e.Row.RowIndex.ToString() _
                                         , i.ToString(), p1)
                    e.Row.Cells(i).Controls.Add(link)
                Else
                    e.Row.Cells(i).Text = String.Empty
                End If
            Next
        End If
    End Sub
End Class
